Portable device and peripheral extension dock

ABSTRACT

An electronic device including a housing, a connector port and a switching device is provided. The connector port is embedded in the housing for a peripheral device inserted therein to electrically connect thereto. The processor is electrically connected to the connector port and comprises a detection pin and a 1-wire pin. The switching device is coupled between the connector port and the processor to selectively connect the connector port to one of the detection pin or the 1-wire pin. When the peripheral device is inserted into the connector port, the processor controls the switching device to connect the connector port to the detection pin to determine whether the connected peripheral device is a 1-wire device. When the processor determines that the connected peripheral device is a 1-wire device, the processor controls the switching device to connect the connector port to the 1-wire pin and the processor executes 1-wire communication with the peripheral device via the 1-wire pin.

CROSS-REFERENCES TO RELATED APPLICATIONS

This application is a Divisional of co-pending application Ser. No.14/581,732, filed on Dec. 23, 2014, which is a Divisional of applicationSer. No. 13/489,027, now U.S. Pat. No. 8,954,628 B2, issued on Feb. 10,2015, all of which are hereby expressly incorporated by reference intothe present application.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The invention relates to a communication method between an electronicdevice and a peripheral device, and more particularly to a communicationmethod between an electronic device and a 1-wire peripheral device.

2. Description of the Related Art

Portable devices, such as smart phones, tablets or personal digitalassistants, have become necessities in business or for personal usage.To increase the functionality of portable devices, lots of peripheraldevices have been developed for the portable devices. Furthermore, todecrease the number of types of connectors of the portable devices andthe complexity of the bus, a 1-wire bus has therefore been adopted. The1-wire bus is a simple bus having only one transmission line, wherecontrol and communication can be implemented. The number of Input/outputports can be saved and the system design of portable devices can be madesimpler, thus, reducing hardware costs for manufacturing. However, evenif portable devices do not connect to a 1-wire device, the portabledevice still must poll the 1-wire bus. Thus, power consumption isincreased, affecting limited battery power, thereby decreasing the usagetime of the portable device.

BRIEF SUMMARY OF THE INVENTION

An embodiment of the invention provides an electronic device comprisinga housing, a connector port and a switching device. The connector portis embedded in the housing for a peripheral device inserted therein toelectrically connect thereto. The processor is electrically connected tothe connector port and comprises a detection pin and a 1-wire pin. Theswitching device is coupled between the connector port and the processorto selectively connect the connector port to one of the detection pin orthe 1-wire pin. When the peripheral device is inserted into theconnector port, the processor controls the switching device to connectthe connector port to the detection pin to determine whether theconnected peripheral device is a 1-wire device. When the processordetermines that the connected peripheral device is a 1-wire device, theprocessor controls the switching device to connect the connector port tothe 1-wire pin and the processor executes 1-wire communication with theperipheral device via the 1-wire pin.

Another embodiment of the invention provides an electronic deviceelectrically connected to an extension device to generate a 1-wire datapath and an interrupt path. The extension electrically connects to atleast one peripheral device. The electronic device comprises a housing,a connector port, a processor and a switching device. The connector portis embedded in the housing which electrically connects to the extensiondevice and to the peripheral device connected to the extension device,wherein when the peripheral device is connected to or removed from theextension device, an interrupt signal is transmitted to the connectorport. The processor is electrically connected to the connector port andcomprises a detection pin, a 1-wire pin and an interrupt pin, whereinthe interrupt pin is connected to the interrupt path via the connectorport to receive the interrupt signal. The switching device is coupledbetween the connector port and the processor to selectively connect the1-wire data path to one of the detection pin or the 1-wire pin. When theprocessor receives the interrupt signal via the interrupt pin, theswitching device connects the 1-wire pin to the 1-wire data path, andthe processor scans the peripheral device via the 1-wire path to acquirea status of the peripheral device.

Another embodiment of the invention provides an extension device coupledto an electronic device. The extension device comprises a firstconnector, a second connector and a controller. The first connectorconnects to a 1-wire peripheral device, wherein the first connectorcomprises a first detection pin and a first 1-wire pin. The secondconnector connects to a peripheral device, wherein the second connectorcomprises a second detection pin and a second 1-wire pin. The controllercomprises a first interrupt pin coupled to the first detection pin, asecond interrupt pin coupled to the second detection pin and an outputpin. When a logic state of the first interrupt pin or the secondinterrupt pin changes, an interrupt signal is output to the electronicdevice via the output pin, and an electrical connection between theelectronic device and the 1-wire peripheral device or the peripheraldevice is established.

A detailed description is given in the following embodiments withreference to the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention can be more fully understood by reading thesubsequent detailed description and examples with references made to theaccompanying drawings, wherein:

FIG. 1 is a schematic diagram of an embodiment of a portable deviceaccording to the invention.

FIG. 2 is a flow chart of a detection and communication method for aperipheral device according to an embodiment of the invention.

FIG. 3 is a schematic diagram of an embodiment of a peripheral extensiondock according to the invention.

FIG. 4 is a schematic diagram of an embodiment of a peripheral extensiondock according to the invention.

FIG. 5 is a schematic diagram of a 1-wire device according to anembodiment of the invention.

FIG. 6 is a flow chart of a detection and communication method for aperipheral device according to an embodiment of the invention.

DETAILED DESCRIPTION OF THE INVENTION

The following description is of the best-contemplated mode of carryingout the invention. This description is made for the purpose ofillustrating the general principles of the invention and should not betaken in a limiting sense. The scope of the invention is best determinedby reference to the appended claims.

FIG. 1 is a schematic diagram of an embodiment of a portable deviceaccording to the invention. The portable device 11 comprises a housing,wherein the processor 111 and the switching device 112 are embeddedinside of the housing, and a connector 113 is embedded in the housingfor connection to external devices. The portable device 11 connects to aconnector 122 of the peripheral device 12 via the connector 113. In thisembodiment, the connector 113 is a micro USB connector. The micro USBconnector comprises 5 pins, wherein an identification pin (the pin P1 inFIG. 1) is used only for the USB On-The-Go standard, and does not workat normal situation. Thus, the pin P1 can be assigned for 1-wirecommunication. The switching device 112 establishes a connection betweenthe processor 111 and the peripheral device 12. The switching device 112establishes a connection between a terminal A and a terminal B0 or aconnection between the terminal A and a terminal B1 according to aselect signal which is output by the processor 111 via the secondgeneral purpose input/output pin (GPIO_2). The second general purposeinput/output pin (GPIO_2) is coupled to a terminal S of the switchingdevice 112. In a default situation or a predetermined situation, theswitching device 112 establishes the connection between the terminal Aand the terminal B0. In one embodiment of the invention, the switchingdevice 112 is a multiplexer.

A first general purpose input/output pin (GPIO_1) of the processor 111is coupled to the terminal B0 of the switching device 112, and a firstresistor R1 is coupled between the terminal N1 and the voltage Vcc. Thepin P2 of the connector 122 is coupled to a 1-wire authenticationcontroller 121 and coupled to ground via a resistor Rs. In thisembodiment, the resistance of the first resistor R1 is substantially 100k ohm, and the resistance of the resistor Rs is substantially 15 k ohm.When the peripheral device 12 connects to the portable device 11, thevoltage of the node N1 is pulled down to a low voltage level. Theprocessor 111 detects the voltage change via the pin GPIO_1, and aninterrupt signal is trigged to inform the portable device 11 that aperipheral device is connected thereto. The detection device 115 detectsthe voltage of the node N1 and determines whether the peripheral device12 is a 1-wire peripheral device. In this embodiment, if the peripheraldevice 12 is a 1-wire device, the resistance of the resistor Rs is 15Kohm. Thus, the detection device 115 determines the resistance of theresistor Rs according to the voltage level of the node N1 and determineswhether the peripheral device 12 is the 1-wire device according to theresistance of the resistor Rs.

When the peripheral device 12 is determined as a 1-wire device, theprocessor 111 transmits a select signal to the switching device 112 toestablish the connection between the node A and node B1. Then, a 1-wiremaster 114 of the processor 111 and a 1-wire authentication controller121 execute 1-wire communication. After the 1-wire communication isfinished or completed, the processor 111 informs the switching device112 to establish the connection between the node A and node B0. In thisembodiment, the 1-wire master may be a specific circuit, a functionalelement, a program executed by the processor 111 or a logic circuit thatis generated by transforming the program executed by the processor 111via a specific program. In this embodiment, the processor 111 controlsthe switching device 112 by controlling the logic level of the pinGPIO_2. For example, when the logic level of the pin GPIO_2 is 0, theswitching device 112 establishes the connection between the node A andB0, and when the logic level of the pin GPIO_2 is 1, the switchingdevice 112 establishes the connection between the node A and B1.

FIG. 2 is a flow chart of a detection and communication method for aperipheral device according to an embodiment of the invention. Themethod of the embodiment reduces the power consumption of the portabledevice having 1-wire communication. The conventional portable devicecontinuously polls the peripheral device to check whether a 1-wireperipheral device is connected thereto. The method of the embodimentexecutes 1-wire communication only when a 1-wire peripheral device isdetected. In the step S21, a first connection, such as the connectionbetween the nodes A and B0, is established. Simply speaking, the firstconnection is a connection between a detector or a detection device ofthe portable device and a connector of the portable device. In the stepS22, the portable device determines whether the peripheral device isconnected to the portable device. In this embodiment, if the peripheraldevice is connected to the portable device, an interrupt signal istransmitted to a processor of the portable device. For example, thedetector is connected to a pin of the connector, and when the peripheraldevice is connected to the portable device, a voltage level of the pinmay be changed to a low voltage level or a high voltage level, and theinterrupt signal is generated accordingly. The interrupt signal informsthe processor of the portable device that the peripheral device isconnected to the portable device. If no peripheral device is connectedto the portable device, the step S24 is executed and the firstconnection is maintained.

In the step S23, the detection device of the portable determines whetherthe connected peripheral device is a 1-wire peripheral device. If yes,the step S25 is executed. In the step S25, the first connection is cut,and a second connection, such as the connection between the node A andnode B1 of FIG. 1, is established. Simply speaking, the secondconnection is the connection between a 1-wire controller of the portabledevice and the connector of the portable device. The second connectionis used to execute 1-wire communication with a 1-wire authenticationcontroller of the peripheral device. When the 1-wire controller finishesthe 1-wire communication with the 1-wire authentication controller, aselect signal is transmitted to a switching device to cut the secondconnection and establish the first connection. In the step S26, theportable device determines whether the 1-wire communication is finished.If not, the step S27 is executed and the second connection ismaintained. If the 1-wire communication is finished, the step S28 isexecuted to cut the second connection and establish the firstconnection.

FIG. 3 is a schematic diagram of an embodiment of a peripheral extensiondock according to the invention. The peripheral extension dock 32comprises a first connector 323 and a second connector 324, wherein eachconnector comprises a 1-wire pin and a detection pin. The detection pinof the first connector 323 connects to the pin GP1 of the controller 321and the detection pin of the second connector 324 connects to the pinGP2 of the controller 321. When a peripheral device connects to thefirst connector 323 or the second connector 324, the voltage level ofthe pin GP1 or GP2 may be changed to a ground voltage level or a highvoltage level, and the controller 321 knows that the peripheral deviceconnects to the peripheral extension dock 32 accordingly. In FIG. 3, a1-wire device 33 is connected to the first connector 323 and a USBdevice 34 is connected to the second connector 324. Since the USB device34 does not support the 1-wire communication, the 1-wire pin of thesecond connector 323 does not work. In this embodiment, the firstconnector 323 and the second connector 324 are micro USB connectors andthe identification pin of the micro USB connector serves as the 1-wirepin.

The peripheral extension dock 32 is connected to the portable device 31and serves as a 1-wire communication medium between the portable device31 and the peripheral device. Each the first connector 323 and thesecond connector 324 comprise a 1-wire pin coupled to a 1-wire detector322 of the controller 321. The 1-wire detector 322 determines whetherthe peripheral device connected to the first connector 323 or the secondconnector 324 is a 1-wire device. If yes, the controller 321 transmits acontrol signal SC1 to the switching device 312 via the pin GP3. When theperipheral device is connected to the peripheral extension dock 32 orremoved from the peripheral extension dock 32, the peripheral extensiondock 32 detects all connected peripheral devices to determine whetherthe current connected peripheral devices comprise a 1-wire device. If a1-wire device is detected, the controller 321 transmits the controlsignal SC1 to the switching device 312 via the pin GP3. For theoperation of the 1-wire detector 322, reference can be made to thedescription of the detection device 115, and will not be described herefor brevity. The peripheral extension dock 32 connects the 1-wire pin ofthe first connector 323 with the 1-wire pin of the second connector 324,and the 1-wire pins are then electrically connected to the switchingdevice 312 of the portable device 31. When the switching device 312receives the control signal SC1, the switching device 312 is turned on,and the 1-wire master 313 of the processor 311 is then connected to the1-wire pin of the first connector 323 and the second connector 324. The1-wire master 313 sequentially executes the 1-wire communication withthe peripheral devices. If the peripheral device is not a 1-wireperipheral device, the peripheral device will not respond to the signal,data or a request transmitted by the 1-wire master 313. After the 1-wiremaster 313 communicates with all of the connected peripheral devices, acontrol signal SC2 is transmitted to the switching device 312 to turnoff the switching device 312.

FIG. 4 is a schematic diagram of an embodiment of a peripheral extensiondock according to the invention. The peripheral extension dock 42comprises a first connector 422 and a second connector 423, wherein eachconnector comprises a 1-wire pin and a detection pin. The detection pinof the first connector 422 is coupled to the pin GP1 of the controller421 and the detection pin of the second connector 423 is coupled to thepin GP2 of the controller 421. When a peripheral device connects to thefirst connector 422 or the second connector 423, the voltage level ofpin GP1 or GP2 is changed to a ground voltage level or a high voltagelevel and the controller 421 determines that there is at least oneperipheral connected to the peripheral extension dock 42, accordingly.In FIG. 4, the first connector 422 connects to a 1-wire device 43 andthe second connector 423 connects to a USB device 44. Since the USBdevice 44 does not support the 1-wire communication, the 1-wire pin ofthe second connector 423 does not work. In this embodiment, the firstconnector 422 and the second connector 423 are micro USB connectors andthe identification pin of the micro USB connector serves as the 1-wirepin.

When a peripheral device is connected to the peripheral extension dock42 or removed from the peripheral extension dock 42, the peripheralextension dock 42 transmits an interrupt signal to the pin GPIO_3 of theprocessor 411. The portable device 41 comprises a processor 411 and aswitching device 412. The switching device 412 establishes theconnection between the processor 411 and the peripheral extension dock42. The switching device 412 establishes the connection between the nodeA and node B0 or the node A and the node B1 according to a select signaltransmitted from the pin GPIO_2 by the processor 411. The pin GPIO_2 iscoupled to the terminal S of the switching device 412. In a defaultcondition, the switching device 412 is pre-set to establish theconnection between the node A and the node B0. In one embodiment of theinvention, the switching device 412 is a multiplexer.

When the processor 411 receives the interrupt signal transmitted by theperipheral extension dock 42, the detector 414 detects whether theperipheral devices connected to the peripheral extension dock 42comprise a 1-wire device. The detector 414 detects the voltage level ofthe node B0 to determine whether there is a 1-wire device connected tothe peripheral extension dock 42. In this embodiment, if the peripheraldevice is a 1-wire device, the pin of the 1-wire device connected to the1-wire pin of the connector is coupled to a resistor Rs, and theresistance of the resistor Rs is substantially 15 k ohm. In thisembodiment, when the 1-wire device 43 is electrically connected to thedetector 414, the voltage level of the node B0 is pulled down. Thus, thedetector 414 can estimate the resistance of the resistor Rs according tothe voltage level of the node B0. If the estimated resistance issubstantially equal to 15 k ohm, the peripheral device connected to theperipheral extension dock 42 is a 1-wire device.

When the detector 414 detects that at least one 1-wire device isconnected to the peripheral extension dock 42, the processor 411transmits a select signal to the switching device 412 to establish theconnection between the node A and the node B1. The 1-wire master 413 andthe 1-wire authentication controller 431 then execute 1-wirecommunication. The 1-wire master 413 sequentially executes the 1-wirecommunication with the peripheral devices connected to the peripheralextension dock 42. If the peripheral device is not a 1-wire peripheraldevice, the peripheral device will not respond to the signal, data or arequest transmitted by the 1-wire master 413. After the 1-wire master413 communicates with all of the connected peripheral devices, the1-wire master 413 stores a status data of the peripheral devicescurrently connected to the peripheral extension dock 42. The status datamay comprise identification information of the connector, a dataindicating whether the connected peripheral device is a 1-wire device,the type of the 1-wire device and the identification of the 1-wiredevice.

In this embodiment, the portable device 41 further comprises a storagedevice to store a plurality of codes. After the 1-wire communication,the 1-wire master 413 compares the received identification informationwith the plurality of codes to identify the peripheral devices.

After the 1-wire communication, the processor 411 informs the switchingdevice 412 to establish the connection between the node A and the nodeB0. In this embodiment, the 1-wire master 413 may be a specific circuitinside the processor, a functional element, a program executed by theprocessor 411 or a logic circuit that is generated by transforming theprogram executed by the processor 411 via a specific program. In thisembodiment, the processor 411 controls the switching device 413 bycontrolling the logic level of the pin GPIO_2. When the logic level ofthe pin GPIO_2 is 0, the switching device 412 establishes the connectionbetween the node A and the node B0. When the logic level of the pinGPIO_2 is 1, the switching device 412 establishes the connection betweenthe node A and the node B1.

In this embodiment, when a peripheral device is connected to theperipheral extension dock 42 or removed from the peripheral extensiondock 42, the peripheral extension dock 42 transmits an interrupt signalINT_O to the processor 411 and the detector 414 detects whether theperipheral devices connected to the peripheral extension dock 42comprises a 1-wire device. When the detector 414 detects that at leastone 1-wire device is connected to the peripheral extension dock 42, theprocessor 411 transmits a select signal to the switching device 412 toestablish the connection between the node A and the node B1. Then, the1-wire master 413 repeats the described operations, which are notdiscussed here for brevity.

FIG. 5 is a schematic diagram of a 1-wire device according to anembodiment of the invention. The 1-wire device 51 comprises a connector511 and a 1-wire authentication controller 512. A pin of the connector511 is grounded via a resistor Rs, wherein the resistance of theresistor Rs is substantially equal to 15 k ohm. When the 1-wire deviceis connected to the electronic device with the 1-wire communicationfunction, an interrupt is generated because of the resistor Rs to informthe electronic device that the 1-wire device 51 has connected thereto.Then, the 1-wire authentication controller 512 executes 1-wirecommunication with the electronic device. After the 1-wirecommunication, the 1-wire authentication controller 512 outputs acontrol signal to the electronic device to interrupt the 1-wirecommunication.

FIG. 6 is a flow chart of a detection and communication method for aperipheral device according to an embodiment of the invention. Themethod of the embodiment reduces the power consumption of the portabledevice having 1-wire communication. The conventional portable devicecontinuously polls the peripheral device to check whether a 1-wireperipheral device is connected thereto. The method of the embodimentexecutes 1-wire communication only when a 1-wire peripheral device isdetected. In the step S21, the peripheral device establishes a firstconnection to the portable device via a peripheral extension dock.Reference to the connection between the nodes A and B0 in FIG. 4 can bemade for an example of the first connection. Simply speaking, the firstconnection is a connection between a detector or a detection device ofthe portable device and a connector of the portable device. In the stepS62, the portable device detects whether the peripheral extension dockexists? If not, the procedure stays at the step S62. If yes, the stepS63 is executed to establish a second connection and cut the firstconnection. Reference to the connection between the nodes A and B1 inFIG. 4 can be made for an example of the second connection. Simplyspeaking, the second connection is a connection between the 1-wiremaster of the portable device and the connector of the portable device.

In the step S64, the portable device detects whether a peripheral deviceis connected to the peripheral extension dock. In this embodiment, whenthe peripheral device is connected to the peripheral extension dock, theperipheral extension dock transmits an interrupt signal to the portabledevice. If no peripheral device is connected to the peripheral extensiondock, the procedure stays at the step S64. If at least one peripheraldevice is connected to the peripheral extension dock, the step S65 isexecuted. In the step S65, the portable device executes 1-wirecommunication with the 1-wire authentication controller of theperipheral device via the second connection. In the step S66, theportable device stores the status data of all the 1-wire devicesconnected to the peripheral extension dock. In another embodiment, theportable device stores the status data of all the peripheral devicesconnected to the peripheral extension dock. In the step S67, theportable device detects whether the peripheral device has been removed?If yes, the step S61 is executed. If not, the step S64 is executed.

While the invention has been described by way of example and in terms ofthe preferred embodiments, it is to be understood that the invention isnot limited to the disclosed embodiments. To the contrary, it isintended to cover various modifications and similar arrangements (aswould be apparent to those skilled in the art). Therefore, the scope ofthe appended claims should be accorded the broadest interpretation so asto encompass all such modifications and similar arrangements.

What is claimed is:
 1. An electronic device, electrically connected toan extension device to generate a 1-wire data path and an interruptpath, wherein the extension electrically connects to at least oneperipheral device, the electronic device comprising: a housing; aconnector port embedded in the housing, electrically connecting to theextension device and to the peripheral device connected to the extensiondevice, wherein when the peripheral device is connected to or removedfrom the extension device, an interrupt signal is transmitted to theconnector port; a processor comprising a detection pin, a 1-wire pin andan interrupt pin, electrically connecting to the connector port, whereinthe interrupt pin is connected to the interrupt path via the connectorport to receive the interrupt signal; and a switching device coupledbetween the connector port and the processor, selectively connecting the1-wire data path to one of the detection pin or the 1-wire pin, whereinwhen the processor receives the interrupt signal via the interrupt pin,the switching device connects the 1-wire pin to the 1-wire data path,and the processor scans the peripheral device via the 1-wire path toacquire a status of the peripheral device.
 2. The device as claimed inclaim 1, wherein the processor generates a status data according to thestatus of the peripheral device and stops scanning the peripheral deviceafter the processor generates the status data.
 3. The device as claimedin claim 2, wherein the processor determines whether the peripheraldevice supports 1-wire communication via the detection pin and executesthe 1-wire communication with the peripheral device via the 1-wire pinwhen the peripheral device supports 1-wire communication.
 4. The deviceas claimed in claim 1, wherein the switching device comprises: a firstterminal coupled to a first pin of the connector port; a second terminalcoupled to the 1-wire pin; and a third terminal coupled to the detectionpin.
 5. The device as claimed in claim 1, wherein the detection pin is ageneral purpose input/output pin, and the detection pin is coupled to avoltage source via a first resistor, and when a voltage level of thedetection pin is pulled down to a low voltage level, the processordetermines that the peripheral device is connected to the electronicdevice.
 6. The device as claimed in claim 4, wherein the connector portis a micro USB connection port and the first pin is an identificationpin of the micro USB connection port.
 7. The device as claimed in claim1, further comprising: a storage device storing a plurality of codes,wherein when the 1-wire communication is finished, the processorcompares identification data received via the 1-wire communication withthe plurality of codes to identify the peripheral device or store thestatus of the peripheral device.